//
//  JGRootViewHelper.m
//  JGRider
//
//  Created by 单启志 on 2018/3/7.
//  Copyright © 2018年 ffq. All rights reserved.
//

#import "JGRootViewHelper.h"
#import "JGTabBarController.h"
#import "JGLoginController.h"
#import "JGCodingHelper.h"
#import "LMJIntroductoryPagesHelper.h"
#import "AdvertiseHelper.h"
#import "JGNavigationController.h"

#import "LMJUMengHelper.h"

@implementation JGRootViewHelper
+ (void)chooseRootController {

    if([[JGCodingHelper share]loginsuccessDataDencode]){
        //登录了
        [self setTabBarViewController];
    }else{//未登录
        [self setLoginViewController];
    }

    //启动欢迎页面
    //[LMJIntroductoryPagesHelper showIntroductoryPageView:@[@"intro_0.jpg", @"intro_1.jpg", @"intro_2.jpg", @"intro_3.jpg"]];

    NSArray <NSString *> *imagesURLS = @[@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1495189872684&di=03f9df0b71bb536223236235515cf227&imgtype=0&src=http%3A%2F%2Fatt1.dzwww.com%2Fforum%2F201405%2F29%2F1033545qqmieznviecgdmm.gif", @"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1495189851096&di=224fad7f17468c2cc080221dd78a4abf&imgtype=0&src=http%3A%2F%2Fimg3.duitang.com%2Fuploads%2Fitem%2F201505%2F12%2F20150512124019_GPjEJ.gif"];
    // 启动广告
    //[AdvertiseHelper showAdvertiserView:imagesURLS];


    // 友盟统计
    //[LMJUMengHelper UMAnalyticStart];
    // 友盟社交化
    [LMJUMengHelper UMSocialStart];
    // 友盟推送
    //[LMJUMengHelper UMPushStart:launchOptions];
}

+(void)setLoginViewController{
    JGNavigationController *navVc=[[JGNavigationController alloc]initWithRootViewController:[[JGLoginController alloc] init]];
    [UIApplication sharedApplication].keyWindow.rootViewController =navVc;
}

+(void)setTabBarViewController{
     [UIApplication sharedApplication].keyWindow.rootViewController = [[JGTabBarController alloc] init];
}
@end
